﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdBrEntity : IDisposable
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdBrEntity(IntPtr cPtr, bool cMemoryOwn)
		{
			this.swigCMemOwn = cMemoryOwn;
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdBrEntity obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdBrEntity()
		{
			this.Dispose();
		}

		public virtual void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdBrEntity(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
		}

		public bool isNull()
		{
			bool result = GlobalsPINVOKE.OdBrEntity_isNull(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool isEqualTo(OdBrEntity pOtherEntity)
		{
			bool result = GlobalsPINVOKE.OdBrEntity_isEqualTo(this.swigCPtr, OdBrEntity.getCPtr(pOtherEntity));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool getBrep(OdBrBrep brep)
		{
			bool result = GlobalsPINVOKE.OdBrEntity_getBrep(this.swigCPtr, OdBrBrep.getCPtr(brep));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool checkEntity()
		{
			bool result = GlobalsPINVOKE.OdBrEntity_checkEntity(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrErrorStatus getSubentPath(OdDbBaseFullSubentPath subPath)
		{
			OdBrErrorStatus result = (OdBrErrorStatus)GlobalsPINVOKE.OdBrEntity_getSubentPath(this.swigCPtr, OdDbBaseFullSubentPath.getCPtr(subPath));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrErrorStatus setSubentPath(OdBrBrep brep, OdDbBaseFullSubentPath subpath)
		{
			OdBrErrorStatus result = (OdBrErrorStatus)GlobalsPINVOKE.OdBrEntity_setSubentPath(this.swigCPtr, OdBrBrep.getCPtr(brep), OdDbBaseFullSubentPath.getCPtr(subpath));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrErrorStatus getPointContainment(OdGePoint3d point, OdGe.PointContainment containment, OdBrEntity brEntContainer)
		{
			OdBrErrorStatus result = (OdBrErrorStatus)GlobalsPINVOKE.OdBrEntity_getPointContainment(this.swigCPtr, OdGePoint3d.getCPtr(point), containment, brEntContainer);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrErrorStatus getLineContainment(OdGeLinearEnt3d line, out uint iNumHitsWanted, out uint iNumHitsFound, OdBrHit brHit)
		{
			OdBrErrorStatus result = (OdBrErrorStatus)GlobalsPINVOKE.OdBrEntity_getLineContainment(this.swigCPtr, OdGeLinearEnt3d.getCPtr(line), out iNumHitsWanted, out iNumHitsFound, brHit);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrErrorStatus setValidationLevel(BrValidationLevel level)
		{
			OdBrErrorStatus result = (OdBrErrorStatus)GlobalsPINVOKE.OdBrEntity_setValidationLevel__SWIG_0(this.swigCPtr, (int)level);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrErrorStatus setValidationLevel()
		{
			OdBrErrorStatus result = (OdBrErrorStatus)GlobalsPINVOKE.OdBrEntity_setValidationLevel__SWIG_1(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public OdBrErrorStatus getValidationLevel(SWIGTYPE_p_BrValidationLevel level)
		{
			OdBrErrorStatus result = (OdBrErrorStatus)GlobalsPINVOKE.OdBrEntity_getValidationLevel(this.swigCPtr, SWIGTYPE_p_BrValidationLevel.getCPtr(level));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		protected bool swigCMemOwn;
	}
}
